package com.xlk.xfire.client;

import java.net.MalformedURLException;

import javax.wsdl.Service;

import com.xlk.xfire.domian.Reader;
import com.xlk.xfire.serviec.IReaderService;

public class ReaderClient {
	public static void main(String[] args) {
		//这里是创建一个service，需要传入一个接口类，因为我们后面必须调用相应的接口方法
		Service srcModel = new ObjectServiceFactory().create(IReaderService.class);
		//代理工厂，这里是为了后面创建相应的接口类
		XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
		//webservice地址，不需要加wsdl
		String readerServiceUrl = "http://localhost:8080/xfireWebService/services/readerService";
		
		try {
			//利用工厂返回相应的接口类
			IReaderService readerService = (IReaderService)factory.create(srcModel,readerServiceUrl);

			Reader reader = readerService.getReader("shun","123");
			System.out.println(reader);
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	}
}